package com.example.cpms.controller;


import cn.dev33.satoken.util.SaResult;
import com.example.cpms.entity.User;
import com.example.cpms.service.UserService;
import com.example.cpms.utils.Result;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@Slf4j
@CrossOrigin
@ResponseBody
@Controller
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 登陆功能
     * @param user
     * @return
     */
    @PostMapping("/park/login")
    public SaResult emailLogin(@RequestBody User user){ //接受前端请求
        System.err.println("login"); //输出日志
        return userService.usernameLoginService(user);
    }

    @GetMapping("/home/workbench/info")
    public Result getAll(){
        log.info("获取总量");
        return userService.getAll();
    }
}

